import { reduce } from "lodash";

//折线图配置
export const LineGraphOption = {
  title: [{
    //图的标题
    show: true,
    text: '',//'用户增长'
    left: "28",
    textStyle: {
      fontSize: 14,
    },
    //副标题
    subtext: '', //"从2020年9月20日更新至2023年9月24日"
  }, {
    //右上角数量
    show: true,
    text: '',//"34,533"
    right: "115",
    top: "28",
    textStyle: {
      color: "rgba(67, 136, 166, 1)",
      fontSize: 30,
    },
  }, {
    //右上角数量的单位
    show: true,
    text: '',// "人"
    right: "97",
    top: "38",
    textStyle: {
      color: "rgba(67, 136, 166, 1)",
      fontSize: 14,
    }
  }],
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'cross',
      show: true
    },
    formatter: function (arg) {
      return arg.reduce((pre, item) => {
        if (item.seriesName == '平台使用时间') {
          item.value = item.value.toFixed(2)
        }
        return pre + `${item.seriesName}:${item.value} <br>`
      }, '') + `日期:${arg[0].name}  `
    },

  },
  legend: {
    /*  left: "center", */
    itemHeight: 6,
    itemGap: 24, bottom: 20,
    data: [],
  },
  series: [
    {
      name: '',
      data: [],
      type: 'line'
    }, {
      name: '',
      data: [],
      type: 'line'
    }
  ],
  grid: {
    top: 80,
  },
  xAxis:
  {
    type: 'category',
    boundaryGap: true,
    axisTick: {
      alignWithLabel: true
    },
    alignTicks: true,
    nameLocation: 'end',
    name: '', /* "时间", */
    nameGap: 10, //名称离轴线距离
    data: [], /* ['1', '2', '3', '4', '5', '6', '7',], */
  },
  yAxis:
  {
    type: 'value',
    name: '',
    splitNumber: 10,
    /*  min: 1,
     max:2,
     interval:0.1 */
  },

}